
import axios from 'axios'

export const base = "http://101.37.23.156:2219"

const request = axios.create({
    baseURL:base
    // baseURL:"http://101.37.23.156:2219/"
})

export const request2 = axios.create({
    baseURL:"http://120.26.90.83:3000"
})


request.interceptors.request.use(req=>{
    localStorage.setItem('loading','true') 
    req.headers.token = (localStorage.getItem("token")?.replaceAll('"',''));
    return req
},(err)=>{
    localStorage.setItem('loading','false')
})

request.interceptors.response.use((res)=>{
    localStorage.setItem('loading','false')
     return res.data
},(err)=>{
    localStorage.setItem('loading','false')
})

request2.interceptors.response.use((res)=>{
    return res.data
})
export default request

